package org.opens.javaskill.strategyMode.if_else.conditional;

import cn.hutool.core.date.DateUtil;
import org.opens.javaskill.strategyMode.if_else.ConditionalResult;
import org.opens.javaskill.strategyMode.if_else.StartAndEndTime;

import java.util.Date;

public class StartOrEndIsNull implements ConditionalResult {

    @Override
    public StartAndEndTime handle() {
        Date today = new Date();
        return StartAndEndTime.builder()
                .startTime(DateUtil.offsetWeek(today, -1))
                .endTime(DateUtil.endOfDay(today))
                .build();
    }
}
